selectionmodel: Add unselect_rest argument to select_callback
authorBenjamin Otte <otte@redhat.com>
Mon, 8 Jun 2020 16:47:44 +0000 (18:47 +0200)
committerBenjamin Otte <otte@redhat.com>
Mon, 8 Jun 2020 17:06:56 +0000 (19:06 +0200)
commit541aaa23920d1e6ac27b186334aadde78a3ecf43
tree222d06dc86c747e25978602fb9137116404dcefc
parentd294b01cee804c95024f1623289686d77c549d62
selectionmodel: Add unselect_rest argument to select_callback

This is not just about consistency with other functions.

It is about avoiding reentrancy problems.

GtkListBase first doing an unselect_all() will then force the
SelectionModel to consider a state where all items are unselected
(and potentially deciding to autoselect one) and then cause a
"selection-changed" emission that unselects all items and potentially
updates all the list item widgets in the GtkListBase to the unselected
state.

After this, GtkListBase selects new items, but to the SelectionModel and
the list item widgets this looks like an enitrely new operation and
there is no way to associate it with the previous state, so the
SelectionModel cannot undo any previous actions it took when
unselecting.
And all listitem widgets will now think they were just selected and
start running animations about selecting.
gtk/gtklistbase.c
gtk/gtkmultiselection.c
gtk/gtkpropertyselection.c
gtk/gtkselectionmodel.c
gtk/gtkselectionmodel.h
testsuite/gtk/multiselection.c